Skip to content

feat: report host OS context under Wine, Proton and Linux containers - #2241

Merged
tustanivsky merged 9 commits into
v1from
feat/wine-host-os-context
Oct 27, 2026
Merged

tustanivsky merged 9 commits into
v1from
feat/wine-host-os-context

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Under Wine and Proton, the OS context currently reports the Windows version that Wine emulates (e.g. Windows 10.0.19045). This reports the host OS instead, in the same shape as the native Linux OS context, next to the wine context added in #1995.

  • Read the host name and kernel release via ntdll's wine_get_host_version export, and split them into name, version and build like on Linux
  • Read the host os-release for the distribution_* fields (through the Z: drive under Wine), preferring /run/host so the host is reported instead of the Steam Runtime or Flatpak container. This applies to native Linux too
  • Report SteamOS and Bazzite as the OS itself: name from NAME, version from VERSION_ID, build from BUILD_ID, with the kernel release in kernel_version
  • Share the uname release split and the os-release parser between the Linux and Windows code
  • Fall back to the Windows OS context when the export is not available (native Windows, or Wine with hidden exports)

Behavior change

  • Under Wine/Proton, os.name changes from Windows to the host OS (Linux, SteamOS, Bazzite, or Darwin on macOS hosts), and the os.name/os.version attributes of logs and metrics change with it.
  • On native Linux inside Steam Runtime or Flatpak containers, distribution_* now reports the host distro instead of the container.
  • On SteamOS and Bazzite (native or Wine), the OS context reports e.g. SteamOS 3.7 instead of Linux 6.x with distribution_name: steamos.

This matches what sentry-godot and sentry-unreal already report via their own OS context overrides, which this PR is meant to replace.

The emulated Windows version is no longer reported. If it is useful, it could be added to the wine context (e.g. windows_version).

Related

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against f42235c

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.22%. Comparing base (5c72012) to head (f42235c).
⚠️ Report is 1 commits behind head on v1.

Additional details and impacted files
@@            Coverage Diff             @@
##               v1    #2241      +/-   ##
==========================================
- Coverage   76.28%   76.22%   -0.06%     
==========================================
  Files         104      104              
  Lines       29717    29813      +96     
  Branches     5504     5530      +26     
==========================================
+ Hits        22670    22726      +56     
- Misses       5671     5701      +30     
- Partials     1376     1386      +10     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tustanivsky
tustanivsky marked this pull request as ready for review October 23, 2026 15:48
@tustanivsky
tustanivsky marked this pull request as draft October 26, 2026 07:35
@jpnurmi

jpnurmi commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

What do you think about targeting v1 since it's not an urgent fix and there's a small behavioral change?

@tustanivsky
tustanivsky changed the base branch from master to v1 October 26, 2026 09:47
Under Wine, build the OS context from the host via wine_get_host_version and the host os-release read through the Z: drive, in the same shape as the native Linux OS context. Prefer /run/host to report the host instead of the Steam Runtime or Flatpak container.
@tustanivsky
tustanivsky force-pushed the feat/wine-host-os-context branch from 31d10d1 to 756c4ee Compare October 26, 2026 09:51
@tustanivsky

Copy link
Copy Markdown
Collaborator Author

What do you think about targeting v1 since it's not an urgent fix and there's a small behavioral change?

Good call, re-targeted it to v1.

@jpnurmi
jpnurmi requested a review from limbonaut October 26, 2026 14:27
@jpnurmi

jpnurmi commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

I'm happy with if both Unreal and Godot are happy with this 😏

Comment thread CHANGELOG.md Outdated
@tustanivsky
tustanivsky marked this pull request as ready for review October 26, 2026 14:34
Comment thread src/sentry_os.c Outdated
Comment thread src/sentry_os.c

build[0] = '\0';

sentry_value_set_by_key(os, "name", sentry_value_new_string(sysname));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both Godot and Unreal currently override OS name for SteamOS and Bazzite, with the distro release in os.version. This implementation would report Linux and the kernel version instead.

Since the PR is intended to replace those overrides, should we bring on that specific naming promotion to native?

cc @mujacica

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, otherwise we’d still need to do the parsing in both SDKs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, added special handling for SteamOS and Bazzite similar to what Unreal/Godot already do. Not sure if other distros need the same treatment but the list is easy to extend if that ever comes up.

@tustanivsky tustanivsky changed the title feat(windows): report host OS context under Wine and Proton feat: report host OS context under Wine, Proton and Linux containers Oct 26, 2026

@limbonaut limbonaut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and a Q

Comment thread tests/assertions.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we adapt these assertions for named OS distributions? In case someone runs these tests on such OS.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added special handling for named distros.

@tustanivsky
tustanivsky merged commit 34b5f37 into v1 Oct 27, 2026
67 checks passed
@tustanivsky
tustanivsky deleted the feat/wine-host-os-context branch October 27, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants